using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(menuName = "Data/State/Player/PlayerRoll", fileName = "PlayerRoll")]
public class PlayerState_Roll : PlayerState
{
    [SerializeField] private float playerRollSpeed;
    //
    public override void Enter()
    {
        base.Enter();
        playerControl.SetSprint(playerRollSpeed);
        playerStatusInformation.SetIsInvincible = true;
    }
    
    //
    public override void Exit()
    {
        base.Exit();
        playerStatusInformation.SetIsInvincible = false;
    }
    
    //
    public override void LogicUpdate()
    {
        base.LogicUpdate();
        if(isAnimationFinished || playerInput.isInputStopRoll)
            stateMachine.SwitchState(stateMachine.stateTable[typeof(PlayerState_Idle)]);
        if(!playerDetection.GetIsGround)
            stateMachine.SwitchState(stateMachine.stateTable[typeof(PlayerState_CoyoteTime)]);
    }
    
    //
    public override void PhysicalUpdate()
    {
        base.PhysicalUpdate();
        animator.SetFloat("Horizontal", playerInput.axesX);
    }
}
